﻿using PDFDesign.Command;
using System.Windows.Input;
using System.Diagnostics;

namespace PDFDesign.ViewModel
{
    public class ViewViewModel : BaseViewModel
    {
        private static readonly object locker = new object();
        private static ViewViewModel viewModel;

        private ViewViewModel() { }
        public static ViewViewModel GetInstance()
        {
            if (viewModel == null)
            {
                lock (locker)
                {
                    if (viewModel == null)
                    {
                        viewModel = new ViewViewModel();
                    }
                }
            }
            return viewModel;
        }
        
        /// <summary>
        /// 默认浏览器打开
        /// </summary>
        public ICommand OpenCommand => new AnotherCommand(_ => Process.Start(Url));

        private string url = "https://www.wsgjp.com/";
        /// <summary>
        /// 预览地址
        /// </summary>
        public string Url
        {
            get => url;
            set
            {
                url = value;
                OnPropertyChanged("Url");
            }
        }
    }
}
